File system enabling fast purges and file access

ABSTRACT

Some embodiments provide a file system for purging content based on a single traversal of the file system that identifies the directory containing the content without performing a secondary traversal within the directory to target the operation to only the file that are associated with content such that other files contained in the directory are unaffected. The file system supplements traditional directory structures with file-level directories. Each file-level directory is created to contain a root file associated with particular content, different variants of the particular content, and supporting files. Consequently, the file system can complete an operation targeting particular content by performing that operation on the file-level directory containing the particular content, thereby eliminating the need to conduct a file-by-file traversal of the containing directory as a prerequisite to identifying the files associated with the particular content and performing the operation on the files individually.

TECHNICAL FIELD

The present invention relates to file systems for storing, accessing,and managing files and more specifically, to a file system that providesefficient purging of stored files.

BACKGROUND ART

File systems almost universally rely on directory structures to trackand organize stored files. The directory structure is composed of atleast one root directory and various directory paths stemming from theroot directory to identify the location of files on the file system.Conceptually, a particular directory path points to a particulardirectory that contains zero or more files and subdirectories.

Each read and write operation to the file system involves traversal ofthe directory structure and some finite amount of time to complete. Newsoftware techniques and hardware technology have improved the timeneeded to complete such operations. For instance, solid state disks areable to complete random read or write operations many times faster thana mechanical disk.

Nevertheless, further improvement and even higher performing filesystems are needed for certain storage critical systems. One such systemheavily reliant on file system performance is a Content Delivery Network(CDN).

A CDN deploys surrogate origin servers, also referred to as cachingservers or edge servers, at various points-of-presence (PoPs) that aregeographically proximate to large numbers of end users. Each PoPincludes multiple caching servers. Each caching server has a finiteamount of storage for locally caching content from various contentproviders. The cached content is then disseminated to the geographicallyproximate end users more expediently than would otherwise occur if thecontent was disseminated from a more distant or underpowered originserver of the content provider originating the cached content.

To ensure the relevance of the cached content, the caching serverscontinually reallocate the storage to retain the most popular content.This reallocation involves continually purging stale content and writingpopular or refreshed content to the storage. Accordingly, there is aneed for a highly optimized file system that can maintain pace with theamount of reads and writes performed by a caching server. Otherwise, anunderperforming file system can create a bottleneck that prevents thecaching server from responding to incoming requests in a timely manner.

SUMMARY OF THE INVENTION

It is an objective of the embodiments described herein to provide a filesystem that efficiently organizes files that are associated with similarcontent. It is further an objective to leverage the efficientorganization of files to optimize certain file level operations. Morespecifically, it is an objective to complete certain operations to aparticular file based on a single traversal of the file system thatidentifies the directory containing the particular file withoutperforming a secondary traversal within the directory to target theoperation to only the desired file or files such that other filescontained in the directory are unaffected.

To achieve these and other objectives, some embodiments provide a filesystem that supplements traditional directory structures with file-leveldirectories. Each file-level directory is created to contain a root fileassociated with particular content, different variants of the particularcontent produced from the root file, and supporting files, such asmetadata and headers, for the root file and file variants. Thefile-level directory isolates the root file, variants, and supportingfiles associated with the particular content from files associated withother content. In so doing, the file system prevents the intermixing ofdifferent content files within a common directory. Consequently, thefile system can complete an operation targeting particular content byperforming that operation on the file-level directory containing theparticular content, thereby eliminating the need to conduct afile-by-file traversal of the containing directory as a prerequisite toidentifying the files associated with the particular content andperforming the operation on the files individually.

In the context of a CDN, the file system creates the file-leveldirectory for specific content based on the URL that is used to requestthat content. The terminal component of the URL can either point to adirectory or a filename.

When the terminal component of the URL points to a directory, thatdirectory is accessed by ordinary traversal of the file system. Allfiles accessible under the specified directory will be stored withintheir respective file-level directories under the specified directory.

When the terminal component of the URL points to a filename, thefilename is appended with an escape modifier, and the requested file isretrieved by traversing the file system according to the directory pathspecified in the URL and by accessing the file-level directory withinthe specified directory path using the filename appended with the escapemodifier. If the file-level directory does not exist, one is created andthe requested file is cached therein once it is retrieved from an originserver or other caching server of the CDN.

In some embodiments, the file system also provides efficient access toindividual files within a file-level directory. Specifically, the filesystem supports direct access to a file variant, wherein the filevariant is identified, in some embodiments, based on a URL and a querystring parameter provided as part of the URL. To reach the file-leveldirectory containing the file variant, the file system appends theescape modifier to the root file filename in the URL. Then to directlyaccess the file variant within the file-level directory, the file systemhashes the query string parameter to produce a filename modifier. Thefilename modifier is applied to the root file filename with the resultspecifying the name of the sought after file variant.

The file system also expedites the completion of certain file leveloperations relative to file systems of the prior art. For instance, aspecific file can be purged by performing a single traversal of the filesystem to identify the file-level directory containing the specific fileand by purging the file-level directory. In contrast, file systems ofthe prior art would perform the first traversal of the file system toidentify the directory containing the specific file and would thenperform a secondary traversal within the containing directory to onlypurge the specific file without affecting other files. By purging theentire file-level directory, the file system set forth herein avoidsthis secondary traversal without any adverse effects. The purge of thefile-level directory purges the specific file, its variants, and anysupporting files. However, this is desired behavior as all files withinthe file-level directory pertain to the same content such that if onefile associated with the content is no longer valid, then other filesare similarly invalidated.

To further expedite purge operations, some embodiments of the filesystem perform a delayed purge. When the purge operation is firstissued, the file system identifies the file-level directory that is thetarget of the purge operation and the file system renames the file-leveldirectory. This effectively prevents other resources from accessing thefile-level directory and its contained files, though the directory andfiles still consume storage. The renaming however can be performedinstantaneously, whereas physically deleting the directory and fileswould require significantly more time to complete. This buys the filesystem time to perform the physical deletion when it is under-utilizedor has available cycles. This delayed purge is critical in a CDNenvironment because during peak hours, the file system will be occupiedretrieving content in order to respond to user requests.

In some embodiments, the renamed file-level directory is batched withother file-level directories that have been renamed as a result of otherpurge operations. An identifier is assigned to the batch of directoriesand the identifier is placed in a file system queue. When the filesystem has available cycles, it then proceeds through the queue deletingall directories and files associated with the next identifier in thequeue.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to achieve a better understanding of the nature of the presentinvention, preferred embodiments for the enhanced file system will nowbe described, by way of example only, with reference to the accompanyingdrawings in which:

FIG. 1 illustrates file storage using the file-level directoriesintroduced as part of the file system of some embodiments.

FIG. 2 conceptually illustrates how the file system of some embodimentsfacilitates efficient file purging relative to file systems of the priorart.

FIG. 3 presents a process for utilizing the file system of someembodiments to facilitate cache retrieval in a CDN caching server.

FIG. 4 presents a process for utilizing the file system of someembodiments to facilitate content purging in a CDN caching server.

FIG. 5 illustrates the advantages of using a regular expression whentargeting an operation to two or more files of a containing directory.

FIG. 6 illustrates a computer system or server with which someembodiments of the file system are implemented.

DETAILED DESCRIPTION

In the following detailed description, numerous details, examples, andembodiments for an optimized file system are set forth and described. Asone skilled in the art would understand in light of the presentdescription, the file system is not limited to the embodiments setforth, and the file system may be practiced without some of the specificdetails and examples discussed. Also, reference is made to theaccompanying figures, which illustrate specific embodiments in which thefile system can be practiced. It is to be understood that otherembodiments can be used and structural changes can be made withoutdeparting from the scope of the embodiments herein described.

Some embodiments provide a file system that automatically organizesfiles associated with different content into different file-leveldirectories. Each file-level directory is created to contain a “root”file associated with particular content, different variants of the rootfile, and supporting files, such as metadata and headers, for the rootfile and its variants. This organizational structure makes the rootfile, its variants, and its supporting files accessible after a singlefile system traversal identifies the containing file-level directory.More importantly, this organizational structure allows the file systemto complete a specific file level operation targeting particular contentby performing that operation on the file-level directory, therebyeliminating the need to conduct a file-by-file traversal of thecontaining directory as a prerequisite to identifying the filesassociated with the particular content and performing the operation onthe files individually.

The proposed file system is unlike those of the prior art in which anydirectory can be intermixed with different files relating to differentcontent. To perform a file level operation in a prior art file system,the file system would need to ensure that the operation being performedaffects only a desired file or subset of files in the containingdirectory. Therefore, the prior art file system performs a firsttraversal (fast file system lookup) to identify the directory containingthe file on which to perform an operation. The prior art file systemthen performs a second traversal (slow directory traversal) of thecontaining directory in order to individually scan each file within thedirectory before determining whether to apply the operation to thatfile. This secondary traversal may occur only when performing theoperation to multiple files within the containing directory, but mayalso occur when performing the operation to a single file within thecontaining directory. In any case, the second traversal greatly slowsthe rate with which certain operations, such as file purging, can beperformed. By eliminating this second traversal, some embodimentsprovide a file system that efficiently executes file level operations.Consequently, some embodiments provide a file system that is optimizedfor a content delivery network (CDN) in which file level operations suchas purges are continually performed and such file level operations woulddegrade performance of the CDN caching servers if not for the optimizedfile system's ability to handle a large volume of these operations inthe highly efficient manner described herein.

An additional complication arises in the context of the CDN. In the CDN,content may be stored on a CDN caching server's file system in itsoriginal form as a root file and variants of that same content may becreated and stored in other files. File variants can be generated toproduce different versions, different encodings, different resolutions,or different compressions of the root file as some examples. A customermay then issue a command to purge the content or the CDN may itselfdecide to purge the content when the content becomes stale. It is thenup to the CDN caching server file system to purge not only the root filebut also each file associated with a produced variant of the content.Each variant is identified by a different filename. Therefore tocomplete the purge, file systems of the prior art track the differentfilenames for the root file and its variants before identifying the oneor more directories in which the files are located. Since the contentpurge involves multiple files (i.e., the root file and its variants),the prior art file systems perform the secondary traversal of the one ormore containing directories in order to scan each of the identifieddirectories file-by-file to identify the root file and its variants.Whenever any such file is identified, it is purged.

The prior art purge methodology greatly degrades the CDN caching serverperformance when the file-by-file analysis is conducted over a largenumber of files and when the CDN caching server is required to trackfilenames for a large number of variants. For example, a particulardirectory may contain a root file and file variant for a particular itemof content, and 98 other files for other content. In performing thepurge of the particular item of content, the prior art file system willscan all hundred files in the directory only to purge two files. In someinstances, the prior art file system will scan all hundred files twice,with a first scan identifying and deleting the root file and a secondscan identifying and deleting the file variant.

These and other deficiencies are overcome by using the file-leveldirectory organizational structure introduced by the file system of theembodiments presented herein. FIG. 1 illustrates file storage using thefile-level directories introduced as part of the file system of someembodiments. As shown, a directory path 110 is provided to identifywhere a file having filename 120 is to be stored. The file system ofsome embodiments appends an escape modifier 140 to the filename 120 anduses the combination to create and provide a name for the file-leveldirectory 130 which will contain the file. The file is then stored inthe file-level directory 130 which is created as a subdirectory in thedirectory path 110. Should the file-level directory 130 already existunder the directory path 110, the file system accesses the file-leveldirectory 130 to perform the file storage operation without creating thefile-level directory 130.

The escape modifier 140 can be appended with the just the filename, withthe filename and file extension, or any variation thereof. In someembodiments, the escape modifier 140 is a colon. However, the escapemodifier 140 can be any sequence of one or more alphanumeric characters.The escape modifier 140 is appended to differentiate the filename 120from the file-level directory 130. Accordingly, the root file for anycontent will be retained within its own file-level directory. Thisprevents the intermixing of different root files in the same containingdirectory, thereby allowing file level operations to be performed on thefile-level directories without the need to perform a file-by-fileanalysis of the containing directory.

The file-level directory 130 is also used to store variants of the rootfile. Each file variant may contain an altered filename of the rootfile. In some embodiments, the altered filename includes the filename ofthe root file with a modifier identifying the specific variant. Forexample, the file-level directory “pic1.jpg:/” contains the root filenamed “pic1.jpg” and variants “pic1_LowRes.jpg” and “pic1_HiRes.jpg”. Inthe context of a CDN, these variants and their corresponding filenamesare derived from query string parameters that are provided as part of aURL that points to the root file. Accordingly, the root filename isprovided in the URL such that the file system can identify the correctfile-level directory for the file variant and store the file varianttherein. If the file-level directory for the file variant does notexist, one is created based on the root file filename contained in theURL. In some embodiments, the query string parameters are hashed toproduce the altered filename identifying the file variant. For example,in the URL “/customer1/id#/content/images/pic1.jpg?res=1024×768” thequery string parameters “?res=1024×768” for filename “pic1.jpg” can behashed to identify the file variant “pic1_(—)429.jpg”. In the context ofa CDN, the URL is provided as part of a content request received by aCDN caching server. The content request is typically encapsulated in anHTTP header such as a HTTP GET request, but can be encapsulated in anyIP datagram or datagram of any other supported networking protocol.

The file-level directory 130 is also used to store supporting files forthe root file and its variants. In some embodiments, the supportingfiles include metadata or header files providing supplemental orcomplimentary data for the root file and its variants. The supportingfiles can identify the supported variants or can track user stateinformation in some embodiments. Each supporting file may have afilename that is derived from the filename of the root file or filevariant to which it relates. As before, the root filename is used toidentify and store the supporting file within the proper file-leveldirectory.

It should be apparent that the file-level directory methodology used forfile storage is also applicable to file access or file retrieval. When afile is requested with a directory path and filename, the file systemappends the escape modifier to the filename to derive the file-leveldirectory. The file system then traverses the specified directory pathto the file-level directory containing the requested file. For example,a file variant named “pic1_(—)429.jpg” can be requested based on the URL“/customer1/id#/content/images/pic1.jpg?res=1024×768”, wherein the filevariant filename “pic1_(—)429.jpg” is derived from the root filefilename specified in the URL (“pic1.jpg”) and a hash of the URL querystring parameters (“?res=1024×768”). The file system retrieves oraccesses the specified file variant by constructing the path to thecontaining file-level directory. To do so, the file system extracts theroot file filename from the URL and constructs the file-level directory“pic1.jpg:/” from the root file filename. The specified file variant canthen be accessed by traversing the directory path and entering the“pic1.jpg:/” file-level directory therein.

In the description above, the root file is named according to thefilename used in the URL to request that file and a file variant isnamed by altering the root file filename with a modifier derived fromthe URL query string parameter identifying the file variant. In someembodiments, the root file is renamed according to a naming conventionand the renamed root file is stored to the proper file-level directory.For example, all root files may be renamed to “c” (or “c.ext”, whereinext is the file extension) such that the root files are easilyidentifiable in any of the file-level directories. The naming conventionis also applied to the file variants and supporting files within thesame file-level directory. For example, each query string variant canbegin with the letter “q” and contain a modifier that is derived from ahash of the query string parameter. In some embodiments, the namingconvention is used to truncate filenames and file paths specified in aURL. This may be performed when URL paths and filenames are specified ina manner that does not comply with file system limitations or tosimplify storage on the file system. In such instances, the file systemmay hash each component of a URL path, replacing each component with itsresulting hash value. For instance, each directory and subdirectorywithin the path “/customer1/longdirectoryname/longfilename.jpg” can behashed to produce the truncated path “/1234/5d2z/1abh.jpg”. To furthertruncate long URL paths, some embodiments hash an entire path to producea single hashed value representing the path. For instance, the path“/customer1/longdirectoryname/longfilename.jpg” can be hashed to producethe truncated “5d61×90/c.jpg”. The hash will consistently reduce thesame URL path to the same truncated path. Since the hashes can becomputed in linear time, the time savings obtained from a simplifiedfile system traversal often outweigh the cost to produce the truncatedpath, thereby expediting access times on the file system and expeditingoverall file system performance.

File access and retrieval using the file-level directories may alsoresult in performance gains as the file-level directory containing thesought after file will include fewer files, thereby allowing the filesystem to identify the sought after file faster than if the containingdirectory included many hundreds or thousands of files. However, thegreatest performance gains realized from using the file-level directoryorganizational structure come when performing file level operations,such as file purging.

As with file access or file retrieval, each operation is specified withat least a directory path and a name of one or more files to be operatedon. The file system converts each filename to a file-level directory byappending the escape modifier to the filename of a root file that isassociated with the file being accessed and by appending the file-leveldirectory name to the directory path. The operation is then applied tothe file-level directory. In so doing, the operation is performed on thespecified file as well as any variants and supporting files contained inthe file-level directory without having to traverse through thefile-level directory to distinguish files that are to be operated onfrom files that are not to be operated on.

FIG. 2 conceptually illustrates how the file system of some embodimentsfacilitates efficient file purging relative to file systems of the priorart. To illustrate these efficiencies, the figure illustrates performingthe same purge operation according to file systems of the prior art insection 210 and according to the file system of the embodimentspresented herein in section 220. The purge involves removing aparticular instance of content represented by the root file“/customer1/images/d.jpg” and file variant“/customer1/images/d_var1.jpg”.

Each file system performs a first file system traversal 230 to reach the“/customer1/images/” directory. As shown in section 210, the prior artfile systems then perform a second traversal 240 consisting of afile-by-file traversal through the “customer1/images/” directory todifferentiate the “d.jpg” and “d_var1.jpg” files to be purged from otherfiles in the directory that are not be purged. After the secondtraversal 240, the “d.jpg” and “d_var1.jpg” files are identified and thefile system can proceed to purge those files.

However, as shown in section 220, the second traversal is altogetheravoided by the file system of some embodiments. Instead, the file systemseeks the “customer1/images/d.jpg:/” directory containing only the rootfile “d.jpg”, its variants “d_var1.jpg”, and its supporting files thatare to be purged, wherein the “d.jpg:/” subdirectory is the file-leveldirectory. The file system then safely purges the file-level directory“d.jpg:/” at 250. This purge removes all files associated with theparticular content including the “d.jpg” and “d_var1.jpg” files withoutperforming the second traversal or file-by-file traversal of thecontaining directory. Other variants or supporting files associated withthe particular content are also purged as a result of purging thefile-directory. This however is desired behavior in the context of aCDN. Specifically, when CDN content changes, all files associated withthat content including the root file, its variants, and supporting filesare no longer valid. Consequently, by purging the file-level directory,the file system of some embodiments efficiently purges all such fileswithout performing the secondary traversal of the file-level directoryor other containing directory, wherein the secondary traversal wouldotherwise greatly degrade the performance of the purge operation as itwould necessitate a file-by-file search through the file-level directoryor other containing directory for the purpose of identifying the filesvariants and supporting files that are to be purged.

The file system of some embodiments is particularly suited for storagecritical environments. As noted above, one such environment is that of aCDN. CDN caching servers have a finite amount of storage that iscontinually reallocated to cache different CDN customer content. As partof the reallocation, the caching servers continually purge stale contentfrom cache to free storage for new content. As such, performance of thecaching servers is heavily reliant on the file system's ability to purgecontent and write content to the cache. When the caching server filesystem cannot efficiently complete these operations, a bottleneck willform causing delay in the caching server's ability to respond to usercontent requests. In other words, the caching server will be occupiedpurging content from cache and writing content to cache instead ofserving cached content to requesting end users. Though the discussionwill proceed describing application of the file system to a CDN, itshould be apparent to one of ordinary skill in the art that the filesystem of some embodiments has general applicability and can thereforebe used in a variety of personal, commercial, and enterpriseenvironments.

FIG. 3 presents a process 300 for utilizing the file system of someembodiments to facilitate cache retrieval in a CDN caching server. Theprocess 300 commences when the CDN caching server performing the processreceives (at 310) a content request from an end user. The contentrequest specifies a URL identifying the content being requested. Morespecifically, the URL specifies a directory path and filename for thecontent being requested.

To determine whether the requested content is cached locally at thecaching server, the process constructs (at 315) the directory path tothe file-level directory for the requested file. Based on any querystring variants provided as part of the URL, the process derives (at320) the filename for the file being requested. Typically when the rootfile is requested, no query string parameters are provided. However,when a variant of the root file is requested, the process hashes thequery string parameters to obtain an identifier and the process in someway combines the file variant identifier to the root file filename inorder to obtain the file variant filename. As noted above, a namingconvention may also be applied when deriving the filename for the filebeing request. The process scans (at 325) the file-level directory forthe derived filename.

If the derived filename is found (at 330) in the file-level directory,the process retrieves and sends (at 335) the requested file to the enduser. Otherwise, the process determines if the derived filename matches(at 340) to the filename of the root file for the requested content.

The process becomes aware that the root file is not cached when thederived filename matches to the filename of the root file and thedetermination at 330 reveals that the root file is not present in thefile-level directory. Accordingly, the process retrieves (at 345) theroot file from an origin server or another caching server, passes (at350) the retrieved root file to the requesting end user while caching(at 355) it within the proper file-level directory applying any namingconvention if applicable. If the derived filename does not match (at340) to the filename of the root file for the requested content, theprocess then knows that the request is for a file variant. Accordingly,the process scans the file-level directory to determine (at 360) if theroot file for the requested file variant is present.

When the root file is cached, the process generates (at 365) the variantrepresented by the derived filename according to the query stringparameters specified in the URL. The resulting file is then passed (at370) to the requesting end user and stored (at 375) to the file-leveldirectory. Otherwise, the process retrieves (at 380) the root file froman origin server or other caching server. The process caches (at 385)the root file. Next, the process generates (at 365) the variant from theroot file, passes (at 370) the resulting file to the requesting end userwhile also storing (at 375) the generated variant to the file-leveldirectory.

FIG. 4 presents a process 400 for utilizing the file system of someembodiments to facilitate content purging in a CDN caching server. Theprocess 400 commences when the CDN caching server performing the process400 is issued (at 410) a purge operation to remove particular content.In the context of the CDN, the purge operation usually specifies the URLassociated with the content being purged, wherein the URL specifies adirectory path where the particular content is stored and a filenameassociated with at least the root file of the particular content. Thepurge operation may be issued by a CDN customer or may be automaticallyissued within the CDN when the particular content becomes stale.Staleness can be automatically determined from a time-to-live parameterassociated with the particular content or from a lack of requests forthe particular content as some example.

The process identifies (at 420) the root file filename for theparticular content and converts (at 430) the root file filename to afile-level directory name. The process then traverses (at 440) the filesystem to the specified directory path deleting (at 450) the file-leveldirectory and any contained files.

In the context of a CDN, it is more likely that purge operations will beissued to remove content and all its associated files. As such, CDNcaching server performance is greatly improved when purging thefile-level directories necessitating only the single file systemtraversal when compared to purging individual files from a containingdirectory which would otherwise introduce the additional delaynecessitated by the secondary traversal of the containing directory toidentify the individual files to be purged therein. It should beapparent to one of ordinary skill in the art that operations besidescontent purging can also be performed more efficiently when using themethodologies of the file system of some embodiments.

To further expedite purge operations, some embodiments of the filesystem perform a delayed purge. In some embodiments, the delayed purgecomprises a two part purging of content. The first part involvesinstantaneously rendering the file-level directory and files associatedwith the content inaccessible without performing the significantly moreexpensive and resource intensive physical deletion of the file-leveldirectory and any contained files. In some embodiments, the first partof the delayed purge is performed by renaming the file-level directorycontaining the files for the content that is to be purged. In so doing,the content is effectively purged as far as the customer or otherresources of the file system are concerned since that content hasdisappeared from the expected paths. The renaming is done to achieve theinstantaneous purging without consuming excessive resources of the filesystem. During peak hours, the file system is sufficiently taxedresponding to content requests and writing of new content to cache.Accordingly, delaying the physical deletion allows the file system to bemore responsive and available during these peak hours.

When the load lessens during off-peak hours, the file system can thenperform the second part of the delayed purge. In some embodiments, thesecond part involves the physical deletion, wherein the file-leveldirectory and contained files are zeroed out or pointers to those filesare deleted from the file system. To more efficiently perform the secondpart of the delayed purge, some embodiments batch the URLs that are tobe purged, assign an identifier to the batch, and place the identifierin a queue. Then, when the file system is lightly loaded, the nextidentifier is popped off the queue. The file system purges the contentincluding the file-level directories and files associated with eachidentifier. Should the load remain light, the file system continues topop additional identifiers off the queue and delete the contentassociated with each identifier.

Thus far, the efficiencies of the file system are realized fromfile-level operations that are performed on the file-level directories,affecting all files stored therein. However, there may be instances inwhich certain operations are specified to target two or more files in afile-level directory without affecting other files in the file-leveldirectory. In some embodiments, the file system implements such granularoperations by constructing a regular expression and by conducting asingle pass through the containing directory using the regularexpression to identify and perform the specified operation on selectfiles.

FIG. 5 illustrates the advantages of using a regular expression whentargeting an operation to two or more files of a containing directory.Specifically, FIG. 5 illustrates the deletion of three files “aa”, “ad”,and “af” in a directory containing files “aa”, “ab”, “ac”, “ad”, “ae”,and “af”. The deletion is shown at 510 according to the file-by-filetraversal performed by some file systems of the prior art and is shownat 520 according to the regular expression traversal of someembodiments.

As shown at 510, the file-by-file traversal involves a first pass 530through the containing directory to identify and delete file “aa”, asecond pass 540 through the containing directory to identify and deletefile “ad”, and a third pass 550 through the containing directory toidentify and delete file “ae”. Each pass scans the files in thecontaining directory one-by-one until the desired file is found anddeleted.

As shown at 520, the regular expression traversal involves a single pass560 through the containing directory. During the directory traversal,the file system compares each file in the containing directory to theregular expression. When a match is found, the specific operation isapplied to that file and the traversal continues until the sole pass iscomplete. The performance advantages of the regular expression traversalincrease according to the number of passes that are saved.

Some embodiments provide a regular expression generator that acceptsfilenames of the files to be operated on as input. The generator thenanalyzes the filenames for commonality and based on the commonality andother pattern matching techniques, the regular expression isautonomously produced.

Efficiencies of the regular expressions can be realized when the filesystem performs operations on a periodic basis or at specified times. Insuch instances, the file system can group files that are targets of thesame operation and from the group, a regular expression generator can begenerated. The operation can then be performed on all files in a givendirectory by performing a single traversal of that directory. It shouldbe apparent that any file system can be optimized to perform operationson multiple files using the regular expressions set forth hereinirrespective of whether the file system adheres to the file-leveldirectory organizational structure advocated herein.

The file system and many of the above-described processes areimplemented as software processes that are specified as a set ofinstructions recorded on non-transitory computer readable storage medium(also referred to as computer readable medium). When these instructionsare executed by one or more computational element(s) (such as processorsor other computational elements like ASICs and FPGAs), they cause thecomputational element(s) to perform the actions indicated in theinstructions. More specifically, when the instructions are executed,they transform a computer system with general computing resources into aspecialized system that accesses and performs file operations accordingto the file system of some embodiments.

Server, computer system, and computing machine are meant in theirbroadest sense and may include any electronic device with a processorthat executes instructions stored on computer readable media or that areobtained remotely over a network connection. Examples of computerreadable media include, but are not limited to, CD-ROMs, flash drives,RAM chips, hard drives, EPROMs, etc. Further, wherever a server isidentified as a component of the embodied invention, it is understoodthat the server may be a single physical machine, or a cluster ofmultiple physical machines performing related functions, or virtualizedservers co-resident on a single physical machine, or variouscombinations of the above.

FIG. 6 illustrates a computer system or server with which someembodiments of the file system are implemented. Such a computer systemincludes various types of computer readable mediums and interfaces forvarious other types of computer-readable mediums that implement theprocesses for the enhanced file system described above. Computer system600 includes a bus 605, a processor 610, a system memory 615, aread-only memory 620, a permanent storage device 625, input devices 630,and output devices 635.

The bus 605 collectively represents all system, peripheral, and chipsetbuses that communicatively connect the numerous internal devices of thecomputer system 600. For instance, the bus 605 communicatively connectsthe processor 610 with the read-only memory 620, the system memory 615,and the permanent storage device 625. From these various memory units,the processor 610 retrieves instructions to execute and data to processin order to execute the processes of the invention. The processor 610 isa processing device such as a central processing unit, integratedcircuit, graphical processing unit, etc.

The read-only-memory (ROM) 620 stores static data and instructions thatare needed by the processor 610 and other modules of the computersystem. The permanent storage device 625, on the other hand, is aread-and-write memory device. This device is a non-volatile memory unitthat stores instructions and data even when the computer system 600 isoff. Some embodiments of the invention use a mass-storage device (suchas a magnetic or optical disk and its corresponding disk drive) as thepermanent storage device 625.

Other embodiments use a removable storage device (such as a flash drive)as the permanent storage device Like the permanent storage device 625,the system memory 615 is a read-and-write memory device. However, unlikethe storage device 625, the system memory is a volatile read-and-writememory, such as random access memory (RAM). The system memory storessome of the instructions and data that the processor needs at runtime.In some embodiments, the processes are stored in the system memory 615,the permanent storage device 625, and/or the read-only memory 620.

The bus 605 also connects to the input and output devices 630 and 635.The input devices enable the user to communicate information and selectcommands to the computer system. The input devices 630 include, but arenot limited to, alphanumeric keypads (including physical keyboards andtouchscreen keyboards) and pointing devices (also called “cursor controldevices”). The input devices 630 also include audio input devices (e.g.,microphones, MIDI musical instruments, etc.). The output devices 635display images generated by the computer system. The output devicesinclude, but are not limited to, printers and display devices, such ascathode ray tubes (CRT) or liquid crystal displays (LCD).

Finally, as shown in FIG. 6, bus 605 also couples computer 600 to anetwork 665 through a network adapter (not shown). In this manner, thecomputer can be a part of a network of computers (such as a local areanetwork (“LAN”), a wide area network (“WAN”), or an Intranet, or anetwork of networks, such as the Internet.

As mentioned above, the computer system 600 may include one or more of avariety of different computer-readable media. Some examples of suchcomputer-readable media include RAM, ROM, read-only compact discs(CD-ROM), recordable compact discs (CD-R), rewritable compact discs(CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layerDVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM,DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini-SD cards,micro-SD cards, etc.), magnetic and/or solid state hard drives, ZIP®disks, read-only and recordable blu-ray discs, any other optical ormagnetic media, and floppy disks.

While the invention has been described with reference to numerousspecific details, one of ordinary skill in the art will recognize thatthe invention can be embodied in other specific forms without departingfrom the spirit of the invention. Thus, one of ordinary skill in the artwould understand that the invention is not to be limited by theforegoing illustrative details, but rather is to be defined by theappended claims.

We claim:
 1. A computer-implemented method for organizing files on acomputer file system, the computer-implemented method comprising:receiving a first storage operation identifying a directory path as astorage location for a first file with a first filename; generating, inresponse to the first storage operation, a first file-level directory asa subdirectory within the directory path identified in the first storageoperation based on the first filename, wherein the first file-leveldirectory isolates variants of the first file from other filesidentified to be in the same directory path, wherein said variantscomprise different versions, encodings, resolutions, or compressions ofthe first file; storing the first file in response to the first storageoperation by accessing the directory path identified in the firststorage operation, further accessing the first file-level directory notidentified in the first storage operation, and generating a copy of thefirst file in the first file-level directory isolating the first fileand variants of the first file from other files identified to be in thesame directory path as the first file; receiving a second storageoperation identifying the same directory path as a storage location fora second file with a second filename; generating a second file-leveldirectory as a subdirectory within the directory path based on thesecond filename, wherein the second file-level directory is a differentsubdirectory under the directory path than the first file-leveldirectory with the second file-level directory isolating variants of thesecond file from other files including the first file identified to bein the same directory path; and storing the second file in response tothe second storage operation by accessing the directory path identifiedin the second storage operation, further accessing the second file-leveldirectory not identified in the second storage operation, and generatinga copy of the second file in the second file-level directory isolatingthe second file and variants of the second file from other filesincluding the first file identified to be in the same directory path asthe second file.
 2. The computer-implemented method of claim 1, whereingenerating the first file-level directory comprises (i) producing a namefor the first file-level directory by appending an escape modifier tothe first filename and (ii) appending the name for the first file-leveldirectory to the directory path.
 3. The computer-implemented method ofclaim 1 further comprising receiving an operation to purge the firstfile from the computer file system and, in response to said operation,deleting the first-file directory without querying for the first file inthe directory path or the first file-level directory.
 4. Thecomputer-implemented method of claim 1 further comprising receiving anoperation to purge content encoded to the first file and, in response tosaid operation, traversing the computer file system to the firstfile-level directory and removing the first file-level directory withoutquerying within the directory path or the first file-level directory forthe first file.
 5. The computer-implemented method of claim 1 furthercomprising receiving a third storage operation for a third filerepresenting a variant of the first file, the third storage operationidentifying the same directory path and a third filename that is derivedfrom the first filename.
 6. The computer-implemented method of claim 5further comprising storing the third file in the first file-leveldirectory and not in the directory path identified by the third storageoperation.
 7. The computer-implemented method of claim 5, wherein thethird storage operation specifies a URL, the URL comprising thedirectory path, the first file filename, and a set of query stringparameters, wherein the third filename is identified as a result ofcombining the first file filename with a hash of the query stringparameters.
 8. The computer-implemented method of claim 1, wherein thefirst file-level directory and the second file-level directory are notspecified in the directory path and wherein the first file-leveldirectory and the second file-level directory are automaticallygenerated by the computer file system as part of storing the first fileand the second file to the computer file system.
 9. Acomputer-implemented method for efficiently purging cached content froma file system, the computer-implemented method comprising: identifying acommon directory path that is specified as a location for a plurality offiles encoding a plurality of different content; generating a newsubdirectory within the directory path for each file of the plurality offiles encoding different content of the plurality of content; for eachset of the plurality of files encoding different variants of samecontent and identified to be in the common directory path, storing theset of files to a subdirectory within the directory path generated forthat same content, wherein said variants comprise different versions,encodings, resolutions, or compressions of the same content; receiving apurge operation directed to particular content of the plurality ofdifferent content; and purging a particular subdirectory within thedirectory path that contains the set of files encoding differentvariants of the particular content identified in the purge operationwithout searching within the directory path or the particularsubdirectory and individually selecting files encoding the particularcontent for deletion.
 10. The computer-implemented method of claim 9,wherein each subdirectory is automatically generated by the file systemby appending the subdirectory to the particular directory path based ona filename for at least one file stored to the subdirectory.
 11. Thecomputer-implemented method of claim 9, wherein purging the particularsubdirectory comprises performing a first purge during a period of heavyload and performing a second purge during a period of light load. 12.The computer-implemented method of claim 11, wherein performing thefirst purge comprises renaming the particular subdirectory andperforming the second purge comprises physically deleting the particularsubdirectory and any contained files from the file system.
 13. Thecomputer-implemented method of claim 9, wherein generating thesubdirectory within the directory path comprises identifying a filenamefor one file encoding the particular content, generating a subdirectoryname based on the filename, and appending the subdirectory name to thedirectory path.
 14. A computer-implemented method comprising: receivinga request for content, the request comprising a URL identifying thecontent by way of a filename that follows a terminal directory of adirectory path; generating a directory name to a new subdirectory notspecified as part of the URL directory path using the filename from therequest; appending the directory name to the terminal directory of thedirectory path; and traversing the directory path in response to saidrequest, wherein said traversing comprises accessing each directory inthe directory path up to the terminal directory and further accessingthe subdirectory with the directory name not specified as part of saidrequest; and serving a file having the filename from the subdirectory inresponse to the request when the file is stored to the subdirectory. 15.The computer-implemented method of claim 14 further comprisingretrieving the file having the filename from an origin server when thefile is not stored to the subdirectory.
 16. The computer-implementedmethod of claim 15 further comprising storing the file to thesubdirectory not specified as part of the URL instead of the terminaldirectory of the directory path specified as part of the URL.
 17. Thecomputer-implemented method of claim 14, wherein the URL includes querystring parameters identifying a variant of the content, wherein saidvariant comprises a different version, encoding, resolution, orcompression of the content.
 18. The computer-implemented method of claim17, wherein the file is a first file, the computer-implemented methodfurther comprising generating a second file storing the variant of thecontent based on the first file having the filename and the query stringparameters when the first file is stored to the subdirectory.
 19. Thecomputer-implemented method of claim 18, wherein serving the file inresponse to the request comprises serving the second file.
 20. Thecomputer-implemented method of claim 18, wherein generating the secondfile comprises hashing the query string parameters and combining aresult of the hashing with the filename to produce a name foridentifying the second file.
 21. The computer-implemented method ofclaim 14 further comprising receiving a request to purge the contentidentified by the URL.
 22. The computer-implemented method of claim 21further comprising purging the subdirectory under the terminal directoryof the directory path without scanning any files of the terminaldirectory and the subdirectory.